Kinetis SDK API Reference Manual  1.0.0-beta
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
fsl_adc_hal.h File Reference
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
#include "fsl_adc_features.h"
#include "fsl_device_registers.h"

Enumerations

enum  adc_clock_source_mode_t {
  kAdcClockSourceBusClk = 0U,
  kAdcClockSourceBusClk2 = 1U,
  kAdcClockSourceAlternate = 2U,
  kAdcClockSourceAsynchrounous = 3U
}
 Defines the selection of the clock source that ADC module uses. More...
 
enum  adc_clock_divider_mode_t {
  kAdcClockDivider1 = 0U,
  kAdcClockDivider2 = 1U,
  kAdcClockDivider4 = 2U,
  kAdcClockDivider8 = 3U
}
 Defines the selection of the clock divider. More...
 
enum  adc_reference_voltage_mode_t {
  kAdcVoltageVref = 0U,
  kAdcVoltageValt = 1U
}
 Defines the selection of the voltage source that ADC module uses. More...
 
enum  adc_long_sample_mode_t {
  kAdcLongSampleExtra20 = 0U,
  kAdcLongSampleExtra12 = 1U,
  kAdcLongSampleExtra6 = 2U,
  kAdcLongSampleExtra2 = 3U
}
 Defines the selection of the long sample extra cycle configuration. More...
 
enum  adc_resolution_mode_t {
  kAdcSingleDiff8or9 = 0U,
  kAdcSingleDiff12or13 = 1U,
  kAdcSingleDiff10or11 = 2U,
  kAdcSingleDiff16 = 3U
}
 Defines the selection of the sample resolution. More...
 
enum  adc_group_mux_mode_t {
  kAdcChannelMuxA = 0U,
  kAdcChannelMuxB = 1U
}
 Defines the selection of the A/B group mux. More...
 
enum  adc_hw_average_mode_t {
  kAdcHwAverageCount4 = 0U,
  kAdcHwAverageCount8 = 1U,
  kAdcHwAverageCount16 = 2U,
  kAdcHwAverageCount32 = 3U
}
 Defines the selection of the time in a hard average mode. More...
 
enum  adc_channel_mode_t {
  kAdcChannel0 = 0U,
  kAdcChannell = 1U,
  kAdcChannel2 = 2U,
  kAdcChannel3 = 3U,
  kAdcChannel4 = 4U,
  kAdcChannel5 = 5U,
  kAdcChannel6 = 6U,
  kAdcChannel7 = 7U,
  kAdcChannel8 = 8U,
  kAdcChannel9 = 9U,
  kAdcChannel10 = 10U,
  kAdcChannel11 = 11U,
  kAdcChannel12 = 12U,
  kAdcChannel13 = 13U,
  kAdcChannel14 = 14U,
  kAdcChannel15 = 15U,
  kAdcChannel16 = 16U,
  kAdcChannel17 = 17U,
  kAdcChannel18 = 18U,
  kAdcChannel19 = 19U,
  kAdcChannel20 = 20U,
  kAdcChannel21 = 21U,
  kAdcChannel22 = 22U,
  kAdcChannel23 = 23U,
  kAdcChannelTemperature = 26U,
  kAdcChannelBandgap = 27U,
  kAdcChannelReferenceVoltageHigh = 29U,
  kAdcChannelReferenceVoltageLow = 30U,
  kAdcChannelDisable = 31U
}
 Defines the selection of the channel inside the ADC module. More...
 
enum  adc_status_t {
  kStatus_ADC_Success = 0U,
  kStatus_ADC_InvalidArgument = 1U,
  kStatus_ADC_Failed = 2U
}
 Defines the status returned from the ADC API. More...
 

Functions

adc_status_t adc_hal_start_calibration (uint32_t instance)
 Starts the calibration process. More...
 
static void adc_hal_end_calibration (uint32_t instance)
 Ends the calibration process. More...
 
uint32_t adc_hal_get_calibration_PG (uint32_t instance)
 Gets and calculates the plus-side calibration parameter. More...
 
static void adc_hal_set_calibration_PG (uint32_t instance, uint32_t val)
 Sets the plus-side calibration parameter to the ADC instance. More...
 
uint32_t adc_hal_get_calibration_MG (uint32_t instance)
 Gets and calculates the minus-side calibration parameter. More...
 
static void adc_hal_set_calibration_MG (uint32_t instance, uint32_t val)
 Sets the minus-side calibration parameter to the ADC instance. More...
 
static uint32_t adc_hal_get_calibration_offset (uint32_t instance)
 Gets the offset value after the auto-calibration. More...
 
static void adc_hal_set_calibration_offset (uint32_t instance, uint32_t value)
 Sets the offset value for manual calibration. More...
 
static void adc_hal_set_clock_source_mode (uint32_t instance, adc_clock_source_mode_t mode)
 Sets the selection of the clock source. More...
 
static void adc_hal_configure_asynchronous_clock (uint32_t instance, bool isEnabled)
 Switches the asynchronous clock on/off. More...
 
static void adc_hal_set_clock_divider_mode (uint32_t instance, adc_clock_divider_mode_t mode)
 Sets the selection of the clock divider. More...
 
static void adc_hal_set_reference_voltage_mode (uint32_t instance, adc_reference_voltage_mode_t mode)
 Sets the selection of the reference voltage source. More...
 
static void adc_hal_configure_high_speed (uint32_t instance, bool isEnabled)
 Switches the high speed mode on/off . More...
 
static void adc_hal_configure_long_sample (uint32_t instance, bool isEnabled)
 Switch the long sample mode on/off. More...
 
static void adc_hal_set_long_sample_mode (uint32_t instance, adc_long_sample_mode_t mode)
 Sets the selection of the long sample mode. More...
 
static void adc_hal_configure_low_power (uint32_t instance, bool isEnabled)
 Switches the low power mode on/off. More...
 
static void adc_hal_set_resolution_mode (uint32_t instance, adc_resolution_mode_t mode)
 Sets the selection of the resolution mode. More...
 
static void adc_hal_configure_continuous_conversion (uint32_t instance, bool isEnabled)
 Switches the continuous conversion mode on/off. More...
 
static void adc_hal_configure_hw_trigger (uint32_t instance, bool isEnabled)
 Switches the hardware trigger mode on/off . More...
 
static void adc_hal_configure_hw_average (uint32_t instance, bool isEnabled)
 Switches the hardware average mode on/off. More...
 
static void adc_hal_set_hw_average_mode (uint32_t instance, adc_hw_average_mode_t mode)
 Sets the selection of the hardware average mode. More...
 
static void adc_hal_configure_hw_compare (uint32_t instance, bool isEnabled)
 Switches the hardware compare mode on/off. More...
 
static void adc_hal_configure_hw_compare_greater (uint32_t instance, bool isEnabled)
 Switches the hardware compare greater configuration on/off . More...
 
static void adc_hal_configure_hw_compare_in_range (uint32_t instance, bool isEnabled)
 Switches the hardware compare range configuration on/off . More...
 
static void adc_hal_set_hw_compare_value1 (uint32_t instance, uint32_t value)
 Sets the value1 in the hardware compare. More...
 
static void adc_hal_set_hw_compare_value2 (uint32_t instance, uint32_t value)
 Sets the value2 in the hardware compare. More...
 
static void adc_hal_configure_dma (uint32_t instance, bool isEnabled)
 Switches the ADC DMA trigger on/off. More...
 
static void adc_hal_disable (uint32_t instance, uint32_t group)
 Switches off the ADC channel conversion. More...
 
static void adc_hal_enable (uint32_t instance, uint32_t group, adc_channel_mode_t mode, bool isDifferential)
 Sets the channel number and switches on the conversion. More...
 
static void adc_hal_configure_interrupt (uint32_t instance, uint32_t group, bool isEnabled)
 Switches the ADC interrupt trigger on/off . More...
 
static bool adc_hal_is_in_process (uint32_t instance)
 Checks whether the ADC is in process. More...
 
static bool adc_hal_is_conversion_completed (uint32_t instance, uint32_t group)
 Checks whether the channel conversion is complete. More...
 
static bool adc_hal_is_calibration_fail (uint32_t instance)
 Checks whether the calibration failed. More...
 
static uint32_t adc_hal_get_conversion_value (uint32_t instance, uint32_t group)
 Gets the conversion value. More...
 
static void adc_hal_set_group_mux (uint32_t instance, adc_group_mux_mode_t group)
 Sets the current group mux that executes the conversion. More...